package Lab06.Q5;

import static java.lang.Math.random;

public class ShapeFactory {
    public enum ShapeType {
        Rectangle,Rhombus,Ellipse
    }
    public Shape makeShape(ShapeType type, double a, double b){
        return switch(type) {
            case Rectangle->new Rectangle(a,b);
            case Ellipse->new Ellipse(a,b);
            case Rhombus->new Rhombus(a,b);
        };
    }
    public Shape randomNextShape(){
        int x= (int) (random()*10000%3);
        return switch(x){
            case 0->new Rectangle(random()*10,random()*10);
            case 1->new Rhombus(random()*10,random()*10);
            case 2->new Ellipse(random()*10,random()*10);
            default -> throw new IllegalStateException("Unexpected value: " + x);
        };
    }
}
